//package org.example.virtualsensors.controller;
//
//import org.example.virtualsensors.entity.model.Sensor;
//import org.example.virtualsensors.service.SensorDataService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//@RestController
//@RequestMapping("/data")
//public class SensorDataController {
//    private final SensorDataService sensorDataService;
//
//    @Autowired
//    public SensorDataController(SensorDataService sensorDataService) {
//        this.sensorDataService = sensorDataService;
//    }
//
//    @GetMapping("/realtime/{sensorKey}")
//    public Sensor getRealtimeData(@PathVariable String sensorKey) {
//        Sensor data = sensorDataService.getSensorData(sensorKey);
//        if (data == null) {
//            throw new RuntimeException("传感器数据未找到: " + sensorKey);
//        }
//        return data;
//    }
//}